{template '_header'}
<div class="page-heading">
    {ifp 'diypage.page.sys.add|diypage.page.diy.add'}
        <span class="pull-right">
            <a class="btn btn-primary btn-sm" href="{php echo webUrl('diypage/page/create')}"><i class="fa fa-plus"></i> 新建页面</a>
        </span>
    {/if}
    <h2><i class="fa fa-circle-o"></i>{if $pagetype=='sys'}系统页面{elseif $pagetype=='diy'}自定义页面{elseif $pagetype=='plu'}应用页面{elseif $pagetype=='mod'}公用模块{/if} <small>总数({$total})</small></h2>

</div>

<form action="/index.php" {ifp 'diypage.page.sys.delete|diypage.page.diy.delete|diypage.page.mod.delete'}method="get"{/if}>
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="diypage.page.{$pagetype}" />

    <div class="page-toolbar row m-b-sm m-t-sm">
        <div class="col-sm-4">
            <div class="input-group-btn">
                <span class="btn btn-default btn-sm" type="button" data-toggle="refresh"><i class="fa fa-refresh"></i></span>
                {if $pagetype=='sys'}
                    {ifp 'diypage.page.sys.delete'}
                        <button class="btn btn-default btn-sm" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{php echo webUrl('diypage/page/sys/delete')}" disabled="disabled"><i class="fa fa-trash"></i> 删除</button>
                    {/if}
                {/if}
                {if $pagetype=='diy'}
                    {ifp 'diypage.page.diy.delete'}
                        <button class="btn btn-default btn-sm" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{php echo webUrl('diypage/page/diy/delete')}" disabled="disabled"><i class="fa fa-trash"></i> 删除</button>
                    {/if}
                {/if}
                {if $pagetype=='plu'}
                    {ifp 'diypage.page.plu.delete'}
                        <button class="btn btn-default btn-sm" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{php echo webUrl('diypage/page/plu/delete')}" disabled="disabled"><i class="fa fa-trash"></i> 删除</button>
                    {/if}
                {/if}
                {if $pagetype=='mod'}
                    {ifp 'diypage.page.mod.delete'}
                        <button class="btn btn-default btn-sm" type="button" data-toggle="batch-remove" data-confirm="确认要删除?" data-href="{php echo webUrl('diypage/page/mod/delete')}" disabled="disabled"><i class="fa fa-trash"></i> 删除</button>
                    {/if}
                {/if}
            </div>
        </div>


        <div class="col-sm-7 pull-right">
            {if $pagetype=='sys'}
                <select name="type" class="form-control  input-sm" style="width:120px;">
                    <option value="" {if empty($_GPC['type'])} selected{/if}>页面类型</option>
                    <option value="2" {if intval($_GPC['type'])==2} selected{/if}>商城首页</option>
                    <option value="3" {if intval($_GPC['type'])==3} selected{/if}>会员中心</option>
                    <option value="5" {if intval($_GPC['type'])==5} selected{/if}>商品详情页</option>
                </select>
            {elseif $pagetype=='plu'}
                <select name="type" class="form-control  input-sm" style="width:120px;">
                    <option value="" {if empty($_GPC['type'])} selected{/if}>页面类型</option>
                    {if p('creditshop')}
                        <option value="4" {if intval($_GPC['type'])==4} selected{/if}>分销中心</option>
                    {/if}
                    {if p('creditshop')}
                        <option value="6" {if intval($_GPC['type'])==6} selected{/if}>积分商城</option>
                    {/if}
                    {if p('seckill')}
                        <option value="7" {if intval($_GPC['type'])==7} selected{/if}>整点秒杀</option>
                    {/if}
                    {if p('exchange')}
                        <option value="8" {if intval($_GPC['type'])==8} selected{/if}>兑换中心</option>
                    {/if}
                </select>
            {/if}
            <div class="input-group">
                <input type="text" class="input-sm form-control" name="keyword" value="{$_GPC['keyword']}" placeholder="请输入页面标题关键字进行搜索">
                <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                </span>
            </div>

        </div>
    </div>

    {if empty($list)}
        <div class="panel panel-default">
            <div class="panel-body" style="text-align: center;padding:30px;">
                未查询到{if !empty($_GPC['keyword'])}"{$_GPC['keyword']}"{/if}相关{if $pagetype=='mod'}模块{else}页面{/if}!
            </div>
        </div>
    {else}

        <table class="table table-hover table-responsive">
            <thead>
            <tr>
                <th style="width:25px;"><input type="checkbox"></th>
                <th>{if $pagetype=='mod'}模块{else}页面{/if}名称(点击预览)</th>
                {if $pagetype=='sys'||$pagetype=='plu'}
                    <th style="width: 90px; text-align: center;">页面类型</th>
                {/if}
                {if $pagetype!='mod'}
                    <th style="width: 100px;">关键字</th>
                {/if}
                <th style="width: 95px;">创建时间</th>
                <th style="width: 95px;">最后修改时间</th>
                <th style="width: 210px">操作</th>
            </tr>
            </thead>
            <tbody>
                {loop $list $item}
                    <tr>
                        <td>
                            <input type="checkbox" value="{$item['id']}">
                        </td>
                        <td>
                            <a href="{if $item['type']==5||$item['type']==7||$item['type']==8}javascript:tip.msgbox.err('{if $item['type']==5}商品详情页{elseif $item['type']==5}秒杀专题页{else}兑换中心{/if}涉及商品数据问题，请至手机端预览');{else}{php echo webUrl('diypage/page/preview', array('id'=>$item['id']))}{/if}" target="_blank">
                                {if ($pagetype=='sys'||$pagetype=='plu') && !empty($diypagedata)}
                                    {if $diypagedata['home']==$item['id'] || $diypagedata['member']==$item['id'] || $diypagedata['commission']==$item['id'] || $diypagedata['detail']==$item['id'] || $diypagedata['creditshop']==$item['id'] || $diypagedata['seckill']==$item['id'] || $diypagedata['exchange']==$item['id']}
                                        <span class="label label-default" style="padding: 3px 5px;">已应用</span>
                                    {/if}
                                {/if}
                                {$item['name']}
                            </a>
                        </td>
                        {if $pagetype=='sys'||$pagetype=='plu'}
                            <td style="text-align: center;"><span class="label label-{$item['typeclass']}">{$item['typename']}</span></td>
                        {/if}
                        {if $pagetype!='mod'}
                            <td>
                                {if $item['type']==5||$item['type']==7||$item['type']==8}-
                                {else}
                                    {if empty($item['keyword'])}<b>未设置</b>{else}{$item['keyword']}{/if}
                                {/if}
                            </td>
                        {/if}
                        <td>{php echo date('Y-m-d', $item['createtime'])}<br>{php echo date('H:i:s', $item['createtime'])}</td>
                        <td>{php echo date('Y-m-d', $item['lastedittime'])}<br>{php echo date('H:i:s', $item['lastedittime'])}</td>
                        <td>
                            {if $pagetype=='sys'}
                                {ifp 'diypage.page.sys.edit'}
                                    <a class="btn btn-default btn-sm" href="{php echo webUrl('diypage/page/sys/edit', array('id'=>$item['id']))}"><i class="fa fa-edit"></i>  编辑</a>
                                {/if}
                                {ifp 'diypage.page.sys.delete'}
                                    <a class="btn btn-default btn-sm" data-toggle="ajaxRemove" href="{php echo webUrl('diypage/page/sys/delete', array('id'=>$item['id']))}" data-confirm="确定要删除该页面吗？"><i class="fa fa-remove"></i> 删除</a>
                                {/if}
                            {/if}
                            {if $pagetype=='diy'}
                                {ifp 'diypage.page.diy.edit'}
                                   <a class="btn btn-default btn-sm" href="{php echo webUrl('diypage/page/diy/edit', array('id'=>$item['id']))}"><i class="fa fa-edit"></i>  编辑</a>
                                {/if}
                                {ifp 'diypage.page.diy.delete'}
                                    <a class="btn btn-default btn-sm" data-toggle="ajaxRemove" href="{php echo webUrl('diypage/page/diy/delete', array('id'=>$item['id']))}" data-confirm="确定要删除该页面吗？"><i class="fa fa-remove"></i> 删除</a>
                                {/if}
                            {/if}
                            {if $pagetype=='plu'}
                                {ifp 'diypage.page.plu.edit'}
                                   <a class="btn btn-default btn-sm" href="{php echo webUrl('diypage/page/plu/edit', array('id'=>$item['id']))}"><i class="fa fa-edit"></i>  编辑</a>
                                {/if}
                                {ifp 'diypage.page.plu.delete'}
                                    <a class="btn btn-default btn-sm" data-toggle="ajaxRemove" href="{php echo webUrl('diypage/page/plu/delete', array('id'=>$item['id']))}" data-confirm="确定要删除该页面吗？"><i class="fa fa-remove"></i> 删除</a>
                                {/if}
                            {/if}
                            {if $pagetype=='mod'}
                                {ifp 'diypage.page.mod.edit'}
                                    <a class="btn btn-default btn-sm" href="{php echo webUrl('diypage/page/mod/edit', array('id'=>$item['id']))}"><i class="fa fa-edit"></i>  编辑</a>
                                {/if}
                                {ifp 'diypage.page.mod.delete'}
                                    <a class="btn btn-default btn-sm" data-toggle="ajaxRemove" href="{php echo webUrl('diypage/page/mod/delete', array('id'=>$item['id']))}" data-confirm="确定要删除该页面吗？"><i class="fa fa-remove"></i> 删除</a>
                                {/if}
                            {/if}

                            {if $pagetype!='mod' && $item['type']!=5 && $item['type']!=7 && $item['type']!=8}
                                <a class="btn btn-default btn-sm js-clip" title="复制链接" data-href="{php echo mobileUrl('diypage', array('id'=>$item['id']), true)}">
                                    <i class="fa fa-link"></i>
                                </a>

                                <a href="javascript:void(0);" class="btn btn-default btn-sm" data-toggle="popover" data-trigger="hover" data-html="true"
                                      data-content="<img src='{$item['qrcode']}' width='130' alt='链接二维码'>" data-placement="auto right">
                                    <i class="glyphicon glyphicon-qrcode"></i>
                                </a>
                            {/if}

                        </td>
                    </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    {/if}
</form>


{template '_footer'}